let fs=require("fs");
//同步写入
var time1=new Date().getTime();

for(i=1;i<=1000;i++){
    fs.writeFileSync("./files1"+i+".txt","我是美女");
              
}
var time2=new Date().getTime();
console.log( "同步写入:"+(time2-time1)+"毫秒");

//异步写入
var time3=new Date().getTime();

for(i=1;i<=1000;i++){
  
    fs.writeFile("./files2/"+i+".txt","我是帅哥",function(err){
      
    });     
}
var time4=new Date().getTime();
console.log( "异步写入:"+(time4-time3)+"毫秒");